package com.example.mz.dynamicdb.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.mz.dynamicdb.entity.Company;
import com.example.mz.dynamicdb.mapper.CompanyMapper;
import com.example.mz.dynamicdb.service.CompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

@Service
@DS("DB3308")
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public class CompanyServiceIml implements CompanyService {

    @Autowired
    public CompanyMapper companyMapper;

    @Override
    public List<Company> getCompanyList() {
        return companyMapper.getCompanyList();
    }

    @Override
    public void addCompany(Company company) {
        companyMapper.addCompany(company);
    }
}
